package com.example.getinputheight;


import android.content.Context;
import android.content.IntentSender.SendIntentException;
import android.graphics.drawable.ColorDrawable;
import android.support.v4.view.ViewPager.LayoutParams;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.widget.Button;
import android.widget.PopupWindow;

public class InputContentPopupWindon extends PopupWindow {
	Context context;
	OnClickListener listener;
	View layout;
	Button btn;
	public InputContentPopupWindon(Context context,OnClickListener listener){
		this.context=context;
		this.listener=listener;
		LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		layout = inflater.inflate(R.layout.input_layout, null);
		btn = (Button) layout.findViewById(R.id.send_btn);
		btn.setOnClickListener(listener);
		this.setContentView(layout);
		this.setWidth(LayoutParams.MATCH_PARENT);//设置宽度
		this.setHeight(LayoutParams.WRAP_CONTENT);//设置高度
		
		ColorDrawable dw = new ColorDrawable(0xb0000000);
//		this.setBackgroundDrawable(dw);//设置背景
//		layout.setOnTouchListener(new OnTouchListener() {
//
//			@Override
//			public boolean onTouch(View v, MotionEvent event) {
//				// TODO Auto-generated method stub
//				int height = layout.findViewById(R.id.select_layout).getTop();
//				int y = (int) event.getY();
//				if(event.getAction()==MotionEvent.ACTION_DOWN){
//					if(y>height){
//						dismiss();
//					}
//				}
//				return false;
//			}
//		});
		
	}


}
